<template>
  <div @click="handleClick">
    <slot></slot>
  </div>
</template>
<script>
import { computed } from '@vue/runtime-core';
export default {
  data(){
    return { 
      val:[]
    }
  },
  props:['checked'],
  emits:['update:checked'],
  provide(){
    this.val = this.checked;
    return {
      checked:computed(()=>this.val),
      handleChecked:(arrs)=>{
        this.val = arrs;
      }
    }
  },
  methods:{
    handleClick(){
      this.$emit('update:checked',this.val);  
    }
  }
}
</script>